# Simple build script for Monarc

CC  = gcc

buildall: disk.flp kernel.bin kernel.elf

clean:
	make -C services/lib/libc clean
	make -C services/lib/libsupc++ clean
	make -C services/lib/libsys clean
	make -C services/lib/gui clean
	make -C services/test clean
	
	make -C kernel/klibc clean
	make -C kernel/acpica clean
	make -C kernel/modules/display clean
	make -C kernel/modules/i8042 clean
	make -C kernel/modules/serial clean
	
	make -C kernel clean
	
	make -C tools clean
	
	-rm -f disk.flp kernel.bin kernel.elf lzss/lzss.exe

disk.flp: kernel/disk.flp
	cp kernel/disk.flp .

kernel.bin: kernel/kernel.bin
	cp kernel/kernel.bin .

kernel.elf: kernel/kernel.bin
	objcopy -O elf32-i386 kernel/kernel.exe ./kernel.elf

kernel/disk.flp: kernel/kernel.bin

kernel/kernel.bin:
	make -C tools
	
	make -C services/lib/libc
	make -C services/lib/libsupc++
	make -C services/lib/libsys
	make -C services/lib/gui
	make -C services/test
	
	make -C kernel/klibc
	make -C kernel/acpica
	make -C kernel/modules/display
	make -C kernel/modules/i8042
	make -C kernel/modules/serial
	
	make -C kernel
